package com.logic.modular.game.battle.info.roundInfo;

import com.baomidou.mybatisplus.extension.service.IService;
import com.logic.modular.game.battle.info.roundInfo.domain.PvpBattleRoundInfo;

import com.logic.modular.game.battle.process.domain.BattleInfo;
import lombok.extern.slf4j.Slf4j;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.logic.modular.game.player.match.mapper.PvpBattleRoundInfoMapper;
import org.springframework.stereotype.Service;

/**
 * pvp战斗回合信息(PvpBattleRoundInfo)表服务实现类
 *
 * @author cxy
 * @since 2024-09-05 17:32:31
 */
@Slf4j
@Service
public class PvpBattleRoundInfoServiceImpl extends ServiceImpl<PvpBattleRoundInfoMapper, PvpBattleRoundInfo> implements IService<PvpBattleRoundInfo> {
    public void collectionBattleReplay(Long battleId) {
        PvpBattleRoundInfo update = new PvpBattleRoundInfo();
        update.setBattleInfo(BattleInfo.selectCache(battleId));
        update.setBattleId(battleId);
        update.setIsCollect(1);
        boolean b = updateById(update);
        if (!b) {
            update.insert();
        }
    }
}
